﻿using KingerRobot.MexicoSailunMDC.Dao;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KingerRobot.MexicoSailunWMS.Spi
{
    public interface IHistoryQuery
    {

        List<PORcsLocation> GetAllInNoTaskLocationsV2();
        /// <summary>
        /// 出入库记录
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        List<StockInOutRecordBeans> QueryStockInOutRecord(StockInOutCondition condition);
        /// <summary>
        /// 按时间获取出入库记录(拆成每小时)
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        List<StockInOutRecordDateBeans> QueryStockInOutRecordByDate(StockInOutDateCondition condition);
        /// <summary>
        /// 按时间获取出入库记录(拆成每十分钟)
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        List<StockInOutRecordDateBeans> QueryMinStockInOutRecordByDate(StockInOutDateCondition condition);

        StockInOutRecordV2Beans QueryStockInOutRecordV3(StockInOutCondition condition);
    }


    #region Beans

    /// <summary>
    /// 出入库记录bean
    /// </summary>
    public class StockInOutRecordBeans
    {
        public string? ProductCode { get; set; }//胎胚条码

        public string? Spec { get; set; }// Spec码 物料名称

        public string? Quality { get; set; }//质量

        public string? TaskType { get; set; }//任务类型
        public DateTime? FinishTime { get; set; }//后端用来排序用

        public DateTime? InCreateTime { get; set; }//入库创建时间

        public DateTime? InFinishTime { get; set; }//入库完成时间

        public string? InStockLocName { get; set; }// 入库放货位置

        public DateTime? OutCreateTime { get; set; }//出库创建时间

        public DateTime? OutFinishTime { get; set; }//出库完成时间

        public string? OutStockLocName { get; set; }//出库取货位置

        public string? TargetEquip { get; set; }//硫化机   目标设备

        public string? StockerName { get; set; }//入库堆垛机名称  目标设备

        public string? LeftRightFlag { get; set; }//左右膜

        public string? TargetEquipCode { get; set; }//硫化机编号  目标设备

        public string? FinishMode { get; set; }//结束类型

        public DateTime? MdTime { get; set; }//生产时间

        public DateTime? BackTime { get; set; }//结束时间



    }


    /// <summary>
    /// 出入库查询bean
    /// </summary>
    public class StockInOutRecordV2Beans
    {

        public int total { get; set; }
        public int start { get; set; }
        public int len { get; set; }
        public List<Row>? rows { get; set; }
    }
    public class Row
    {
        public string? ProductCode { get; set; }//胎胚条码

        public string? Spec { get; set; }// Spec码 物料名称

        public string? Quality { get; set; }//质量

        public string? TaskType { get; set; }//任务类型
        public DateTime? FinishTime { get; set; }//后端用来排序用

        public DateTime? InFinishTime { get; set; }//入库完成时间

        public string? InStockLocName { get; set; }//入库放货位置

        public DateTime? OutFinishTime { get; set; }//出库完成时间

        public string? OutStockLocName { get; set; }//出库取货位置

        public string? TbmNo { get; set; }//成型机
        public string? TargetEquip { get; set; }//硫化机   目标设备

        public string? StockerName { get; set; }//入库堆垛机名称  目标设备

        public string? LeftRightFlag { get; set; }//左右膜

        public string? TargetEquipCode { get; set; }//硫化机编号  目标设备

        public string? FinishMode { get; set; }//结束类型

        public DateTime? MdTime { get; set; }//生产时间

        public DateTime? BackTime { get; set; }//结束时间

        public DateTime? CreateTime { get; set; }//任务生成时间

    }

    /// <summary>
    /// 按小时出入库记录
    /// </summary>
    public class StockInOutRecordDateBeans
    {
        public string Hour { get; set; }
        public int InNum { get; set; }
        public int OutNum { get; set; }
        public int DirectCount { get; set; }

    }

    public class EmsRecordDateBeans
    {
        public string TargetName { get; set; }
        public string EmsName { get; set; }
        public int TaskNo { get; set; }
        public DateTime ExcuteTime { get; set; }

        public DateTime EndTime { get; set; }

    }


    #endregion



    #region 条件查询类
    /// <summary>
    /// 出入库记录 查询条件类
    /// </summary>
    public class StockInOutCondition
    {
        public DateTime? StartTime { get; set; }//开始时间

        public DateTime? EndTime { get; set; }//结束时间

        public string ProductCode { get; set; }//胎胚条码

        public int? TaskType { get; set; }//任务类型，0 - 全部， 1 - 入库， 2 - 出库
        public string CuringCode { get; set; } // 硫化机

        public string StockerCode { get; set; } //堆垛机编号

        public string CrnName { get; set; }//堆垛机名称

        public string LocCode { get; set; }//货位编号

        public string Spec { get; set; }//规格（spec码）

        public int? Page1 { get; set; }
        public int? Limit1 { get; set; }

    }
    #endregion
}
public class StockInOutDateCondition
{
    public string Date { get; set; }
}
